package com.demo;

public class Singleton {
    private static Singleton instance = null;    
    //私有的构造方法
    private Singleton() {
        
    }   
    //静态内部类
    public static class SingletonHelper{
    	private static final Singleton INSTANCE=new Singleton();
    }
  //static修饰可以通过类直接调用这个方法
    public static  Singleton getInstance() {      
        instance=SingletonHelper.INSTANCE;
        return instance;
    }
}
